package com.giantlizard.cloud.base.enums;

import lombok.Getter;

@Getter
public enum DelFlagEnum {

        /**
        * 未删除
        */
        UNDELETE(0, "未删除"),

        /**
        * 已删除
        */
        DELETED(1, "已删除");

        private final Integer code;

        private final String name;

    DelFlagEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getNameByCode(Integer code) {
        for (DelFlagEnum t : values()) {
            if (t.getCode().equals(code)) {
                return t.getName();
            }
        }
        return null;
    }

    public static Integer getCodeByName(String name) {
        for (DelFlagEnum t : values()) {
            if (t.getName().equals(name)) {
                return t.getCode();
            }
        }
        return null;
    }

}
